<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
<link href="/resource/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="/resource/js/bootstrap.js"></script>
<head>
<meta charset="UTF-8">
<title>sku列表</title>
</head>
<body>

	<div>
		<form id="form1">
			关键字:<input type="text" name="keyWord" value="${vo.keyWord }"> 价格:从<input
				type="number" name="minPrice" value="${vo.minPrice }">到<input
				type="number" name="maxPrice" value="${vo.maxPrice }"> 更新时间:从<input
				type="date" name="minTime" value='<fmt:formatDate value="${vo.minTime }" pattern="yyyy-MM-dd" />'>到<input type="date"
				name="maxTime" value='<fmt:formatDate value="${vo.minTime }" pattern="yyyy-MM-dd" />'><br> 排序数据项：<input
				type="checkbox" name="sortColumn" value="id" ${vo.sortColumn[0]=='id'?"checked":"" }>id <input
				type="checkbox" name="sortColumn" value="price" ${vo.sortColumn[0]=='price'?"checked":"" }>价格 <input
				type="checkbox" name="sortColumn" value="stock_count" ${vo.sortColumn[0]=='stock_count'?"checked":"" }>库存 <input
				type="checkbox" name="sortColumn" value="update_time" ${vo.sortColumn[0]=='update_time'?"checked":"" }>更新时间 <select
				name="sortType">
				<option value="asc" ${vo.sortType==''?"selected":"" }>请选择</option>
				<option value="asc" ${vo.sortType=='asc'?"selected":"" }>升序</option>
				<option value="desc" ${vo.sortType=='desc'?"selected":"" }>降序</option>

			</select>
			<button type="button" onclick="sub()">查询</button>
		</form>

	</div>
	<table class="table table-hover">
		<tr>
			<td>id</td>
			<td>商品名称</td>
			<td>品牌</td>
			<td>分类</td>
			<td>标题</td>
			<td>买点</td>
			<td>价格</td>
			<td>库存</td>
			<td>更新时间</td>
			<td>图片</td>
			<td>操作</td>
		</tr>
		<c:forEach items="${info.list }" var="s">
			<tr>
				<td>${s.id }</td>
				<td>${s.spu.goodsName }</td>
				<td>${s.spu.brand.name }</td>
				<td>${s.spu.category.name }</td>
				<td>${s.title }</td>
				<td>${s.sellPoint }</td>
				<td>${s.price }</td>
				<td>${s.stockCount }</td>
				<td><fmt:formatDate value="${s.updateTime }"
						pattern="yyyy-MM-dd" /></td>
				<td><img alt="" src="/pic/${s.image }" width="50" height="50">
				</td>
				<td>
				<button type="button" onclick="toupdate(${s.id })">修改</button>|
				<button type="button" onclick="del(${s.id })">删除</button>
				</td>
			</tr>

		</c:forEach>
	</table>
	<jsp:include page="/WEB-INF/view/common/pages.jsp"></jsp:include>
	<script type="text/javascript">
		function goPage(pageNum) {

			var url = "sku/list?pageNum=" + pageNum;
			$("#workArea").load(url,$("#form1").serialize());
		}
		
		function sub() {
			var url = "sku/list";

			$("#workArea").load(url, $("#form1").serialize());
		}
		function toupdate(id){
			var url = "sku/toupdate?id=" + id;
			$("#workArea").load(url);
			
		}
	</script>
</body>
</html>